home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
graphic
/
flilib.zip
/
FLIDOC.TXT
< prev
next >
Wrap
Text File
|
1990-02-20
|
45KB
|
1,334 lines
Turbo C FLI Library Documentation
For FLI Files Created by Autodesk Animator
November 20, 1989
Copyright 1989-1990 Dancing Flame, San Francisco
Program Code and Library by Jim Kent
Documentation by Jim Kent and Heidi Brumbaugh
Turbo C FLI Library
Table of Contents
1. Introduction to the Turbo C FLI library. . . . . . . . . . 1
2. Sample FLI programs. . . . . . . . . . . . . . . . . . . . 1
2.1 PLAY.C . . . . . . . . . . . . . . . . . . . . . . . 1
2.2 ALLFLIS.C. . . . . . . . . . . . . . . . . . . . . . 2
2.3 SLICEFLI.C . . . . . . . . . . . . . . . . . . . . . 3
3. Usage of FLI routines. . . . . . . . . . . . . . . . . . . 5
3.1 Playback Routines. . . . . . . . . . . . . . . . . . 5
3.2 Save Routines. . . . . . . . . . . . . . . . . . . . 6
4. VGA Graphics Support . . . . . . . . . . . . . . . . . . . 7
5. MS-DOS Support . . . . . . . . . . . . . . . . . . . . . . 8
6. The FLILIB header files. . . . . . . . . . . . . . . . . . 10
6.1 AAFLISAV.H . . . . . . . . . . . . . . . . . . . . . 10
6.2 AAFLI.H. . . . . . . . . . . . . . . . . . . . . . . 11
6.3 AATYPES.H . . . . . . . . . . . . . . . . . . . . . 13
6.4 AADOS.H. . . . . . . . . . . . . . . . . . . . . . . 14
6.5 AAERR.H. . . . . . . . . . . . . . . . . . . . . . . 16
6.6 AASCREEN.H . . . . . . . . . . . . . . . . . . . . . 16
8. Autodesk Animator files. . . . . . . . . . . . . . . . . . 18
8.1 Flic Files (.FLI). . . . . . . . . . . . . . . . . . 18
8.2 Picture Files (.GIF) . . . . . . . . . . . . . . . . 21
8.3 Cel Files (.CEL and .PIC). . . . . . . . . . . . . . 21
8.4 Palette Files (.COL) . . . . . . . . . . . . . . . . 22
8.5 Mask Files (.MSK). . . . . . . . . . . . . . . . . . 22
8.6 Text Files (.TXT). . . . . . . . . . . . . . . . . . 22
8.7 Font Files (.FNT). . . . . . . . . . . . . . . . . . 22
8.8 Polygon and Path files (.PLY). . . . . . . . . . . . 24
8.9 Optics Files (.OPT). . . . . . . . . . . . . . . . . 24
8.10 Record Files (.REC) . . . . . . . . . . . . . . . . 24
1. Introduction to the Turbo C FLI library
FLI.LIB is a Turbo C large model library for manipulating
Autodesk Animator FLI files. It also contains some general-
purpose MS-DOS functions and a few VGA graphics primitives.
The main Turbo C library is contained in the file FLI.LIB.
Additionally, you will need to include the header file AAFLI.H to
read a FLI file and AAFLISAV.H to save a FLI file. AAFLI.H will
include the additional files AATYPES.H, AADOS.H, AAERR.H and
AASCREEN.H if they are not already included. AAFLISAV.H will
include AAFLI.H if it is not already included.
The 58 source file routines to load or save a FLI are in the
folder LIBSOURC; however, these modules are not necessary as they
are already included in FLI.LIB.
Your disk also includes three sample C files to load and
play a FLI file. The sample batch file which compiles these
files in Turbo C is:
tcc -ml play.c fli.lib
tcc -ml allflis.c fli.lib
tcc -ml slicefli.c fli.lib
In sum, the files you will need to use the Turbo C FLI
library are:
AATYPES.H
AADOS.H
AAERR.H
AASCREEN.H
AAFLI.H
AAFLISAV.H
FLI.LIB
2. Sample FLI programs
Once the header files are included in your code and your
make file is set up to properly link your program with the
library, calling the high-level FLI routines is very
straightforward. In fact, the sample programs show that you can
write a program to play back a FLI in about twenty-five lines --
and most of that code is to verify that a VGA is connected!
2.1 PLAY.C
This program will play a FLI file until a key is pressed.
#include "aafli.h"
main(int argc, char *argv[])
{
int ivmode;
Errval err;
if (argc != 2) /* If command line looks wrong give a little help */
{
puts("Play will play a FLI file until a key is hit");
puts("Example usage: play pretty.fli");
}
else
{
ivmode = dos_get_vmode(); /* Get video mode to restore at exit */
dos_set_vmode(0x13); /* Go into 320x200 256 color mode */
if (dos_get_vmode() == 0x13)
{
err = fli_play(argv[1]);
dos_set_vmode(ivmode);
if (err < AA_SUCCESS)
puts(fli_error_message(err) );
}
else
puts("Not a VGA/MCGA display");
}
}
2.2 ALLFLIS.C
This program plays all the FLI files in the current directory
once and exits.
#include "aafli.h"
main()
{
Fndata *fn;
int ivmode;
Errval err;
fn = dos_get_dta();
if (dos_first("*.FLI", DOS_ATTR_NORMAL))
{
ivmode = dos_get_vmode();
dos_set_vmode(0x13);
if (dos_get_vmode() == 0x13)
{
for (;;)
{
if (dos_key_is()) /* check keyboard to abort between FLI's */
{
dos_key_in();
break;
}
err = fli_once(fn->name);
if (err < AA_SUCCESS)
{ puts(fli_error_message(err));
}
if (!dos_next())
break;
}
dos_set_vmode(ivmode);
}
else
{
puts("Not a VGA/MCGA display");
}
}
else
{
puts("No .FLI files");
}
}
2.3 SLICEFLI.C
This program cuts out every other line of a FLI file, creating a
new FLI.
#include "aaflisav.h"
main(int argc, char *argv[])
{
int i;
Errval err;
int ivmode;
if (argc != 3)
{
puts("slicefli - a program to cut out every other line of a FLI.");
puts(" usage: slicefli infile.fli outfile.fli");
exit(0);
}
ivmode = dos_get_vmode();
dos_set_vmode(0x13); /* To VGA/MCGA 320x200 256 color mode */
if (dos_get_vmode() != 0x13)
{
puts("Not a VGA/MCGA display, sorry");
}
else
{
err = convert_fli(argv[1], argv[2]);
if (err >= AA_SUCCESS)
{
fli_play(argv[2]);
}
dos_set_vmode(ivmode);
if (err < AA_SUCCESS)puts(fli_error_message(err));
}
}
/* zero out every other line of a screen */
void slice_screen(Vscreen *s)
{
int i;
Pixel *p;
p = s->p;
for (i=0; i<s->h; i+=2)
{
i86_bzero(p, s->bpr);
p += 2*s->bpr;
}
}
Errval convert_fli(char *in, char *out)
{
Errval err = AA_SUCCESS; /* start out optimistic! */
Vscreen *bs;
Fli_head inhead, outhead;
Jfile infile = 0, outfile = 0;
int i;
if ((bs = aa_alloc_mem_screen()) == NULL)
{
err = AA_ERR_NOMEM;
goto EXIT;
}
if ((infile = fli_open(in, &inhead)) < 0)
{
err = infile;
goto EXIT;
}
if ((outfile = fli_create(out, &outhead, inhead.speed)) < AA_SUCCESS)
{
goto EXIT;
}
for (i=0; i<inhead.frame_count; i++)
{
aa_copy_screen(&aa_screen, bs);
if ((err = fli_next_frame(infile)) < AA_SUCCESS)
{
goto EXIT;
}
slice_screen(&aa_screen);
if ((err = fli_write_next(outfile, &outhead, &aa_screen, bs)) <
AA_SUCCESS)
{
goto EXIT; }
}
if ((err = fli_end(outfile, &outhead, &aa_screen, bs)) < AA_SUCCESS)
{
goto EXIT;
}
EXIT:
if (infile != 0)
dos_close (infile);
if (outfile != 0)
dos_close (outfile);
aa_free_mem_screen(bs);
if (err < AA_SUCCESS)
{
dos_delete (out);
}
return(err);
}
3. Usage of FLI routines
3.1 Playback Routines
These are the main routines you will need to use to play
back a FLI animation. Note that you do not need to call some of
the routines directly if you use only the high-level routines.
See the sample programs above for details.
Play a FLI on VGA screen until a key is hit.
Errval fli_play(char *fliname)
Play a FLI through once on VGA screen.
Errval fli_once(char *fliname)
Open up a FLI file,